
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>ambient.Profile &#8212; Texas A&amp;M Oil spill / Outfall Calculator 2.1.0 documentation</title>
    <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="ambient.Profile.append" href="ambient.Profile.append.html" />
    <link rel="prev" title="Overview of Ambient Module" href="../../modules/ambient.html" />
   
  <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="ambient-profile">
<h1>ambient.Profile<a class="headerlink" href="#ambient-profile" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="ambient.Profile">
<em class="property">class </em><code class="sig-prename descclassname">ambient.</code><code class="sig-name descname">Profile</code><span class="sig-paren">(</span><em class="sig-param">data, ztsp=['z', 'temperature', 'salinity', 'pressure'], chem_names=None, err=0.01, ztsp_units=['m', 'K', 'psu', 'Pa'], chem_units=None, current=None, current_units=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/ambient.html#Profile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ambient.Profile" title="Permalink to this definition">¶</a></dt>
<dd><p>Class object for ambient seawater profiles</p>
<p>This object collects the data describing the ambient seawater (e.g., 
CTD data, currents, etc.) and provides efficient access to interpolated
results at arbitrary depths.  All of the raw data are stored in a 
netCDF4-classic format dataset, which resides on the hard-drive.  Profile
objects can be initiated either from an open netCDF dataset object or 
from a file path to the desired object.  The netCDF dataset is expected
to have variables for ‘z’, ‘temperature’, ‘salinity’, and ‘pressure’ and 
any other variables requested at instantiation through the chem_names
variable.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>nc</strong><span class="classifier">netCDF dataset object, path, or str</span></dt><dd><p>Provides the information necessary to access the netCDF dataset.  If
a file path or string is provided, then the netCDF file is opened
and the resulting dataset object is stored in self.nc.</p>
</dd>
<dt><strong>ztsp</strong><span class="classifier">str list</span></dt><dd><p>String list containing the variables names for depth, temperature, 
salinity, and pressure that are used in the netCDF dataset.</p>
</dd>
<dt><strong>chem_names</strong><span class="classifier">str list, optional</span></dt><dd><p>Names of the chemicals (e.g., those constituents in addition to z, T, 
S, P) in the netCDF dataset that should be accessible through the 
<cite>self.get_values</cite> interpolation method or the <cite>self.get_units</cite> 
interrogator.  If <cite>chem_names</cite> = ‘all’, then all variables in the 
netCDF file except for ‘time’, ‘lat’, ‘lon’, and the strings in 
<cite>ztsp</cite> will be loaded as ambient chemical data.</p>
</dd>
<dt><strong>err</strong><span class="classifier">float</span></dt><dd><p>The interpolation dataset is a subset of the complete raw dataset 
stored in the netCDF file.  err sets the acceptable level of 
relative error using linear interpolation expected of the 
<cite>self.get_values</cite> method.  This value is passed to the <cite>coarsen</cite> 
function to provide an optimal interpolation dataset.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><code class="xref py py-obj docutils literal notranslate"><span class="pre">netCDF4</span></code>, <a class="reference internal" href="ambient.create_nc_db.html#ambient.create_nc_db" title="ambient.create_nc_db"><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_nc_db</span></code></a>, <a class="reference internal" href="ambient.fill_nc_db.html#ambient.fill_nc_db" title="ambient.fill_nc_db"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fill_nc_db</span></code></a>, <a class="reference internal" href="ambient.coarsen.html#ambient.coarsen" title="ambient.coarsen"><code class="xref py py-obj docutils literal notranslate"><span class="pre">coarsen</span></code></a>, <a class="reference internal" href="../../modules/chem.html#module-chemical_properties" title="chemical_properties"><code class="xref py py-obj docutils literal notranslate"><span class="pre">chemical_properties</span></code></a></dt><dd></dd>
</dl>
</div>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">bm54</span> <span class="o">=</span> <span class="n">Profile</span><span class="p">(</span><span class="s1">&#39;./test/output/test_BM54.nc&#39;</span><span class="p">,</span> <span class="n">chem_names</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span> <span class="n">bm54</span><span class="o">.</span><span class="n">nc</span><span class="o">.</span><span class="n">variables</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="go">[&#39;time&#39;, &#39;lat&#39;, &#39;lon&#39;, &#39;z&#39;, &#39;temperature&#39;, &#39;salinity&#39;, &#39;pressure&#39;, </span>
<span class="go">&#39;T&#39;, &#39;wetlab_fluorescence&#39;, &#39;S&#39;, &#39;density&#39;, &#39;oxygen&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bm54</span><span class="o">.</span><span class="n">get_values</span><span class="p">(</span><span class="mf">1000.0</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;temperature&#39;</span><span class="p">,</span> <span class="s1">&#39;salinity&#39;</span><span class="p">,</span> <span class="s1">&#39;pressure&#39;</span><span class="p">])</span>
<span class="go">array([  2.78274540e+02,   3.49278396e+01,   1.01933088e+07])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bm54</span><span class="o">.</span><span class="n">get_units</span><span class="p">(</span><span class="s1">&#39;oxygen&#39;</span><span class="p">)</span>
<span class="go">[&#39;kg/m^3&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bm54</span><span class="o">.</span><span class="n">buoyancy_frequency</span><span class="p">(</span><span class="mf">1500.</span><span class="p">)</span>
<span class="go">0.00081815</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bm54</span><span class="o">.</span><span class="n">nc_close</span><span class="p">()</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Attributes</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>nc_open</strong><span class="classifier">bool</span></dt><dd><p>Flag stating whether or not the netCDF dataset is open or closed</p>
</dd>
<dt><strong>nchems</strong><span class="classifier">int</span></dt><dd><p>Number of chemicals in <cite>chem_names</cite></p>
</dd>
<dt><strong>z</strong><span class="classifier">ndarray</span></dt><dd><p>Array containing the complete raw dataset of depths</p>
</dd>
<dt><strong>y</strong><span class="classifier">ndarray</span></dt><dd><p>Array containing the complete raw dataset for T, S, P, and chemicals 
in <cite>chem_names</cite>.</p>
</dd>
<dt><strong>f_names</strong><span class="classifier">str list</span></dt><dd><p>concatenated string list containing <cite>ztsp</cite> and <cite>chem_names</cite></p>
</dd>
<dt><strong>f_units</strong><span class="classifier">str list</span></dt><dd><p>List of units associated with the variables stored in <cite>f_names</cite>.</p>
</dd>
<dt><strong>f</strong><span class="classifier">object</span></dt><dd><p><cite>scipy.interpolate.interp1d</cite> object containing <cite>z</cite> and <cite>y</cite>.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.append.html#ambient.Profile.append" title="ambient.Profile.append"><code class="xref py py-obj docutils literal notranslate"><span class="pre">append</span></code></a>(self, data, var_symbols, var_units[, …])</p></td>
<td><p>Add data to the netCDF dataset and update the object attributes</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.buoyancy_frequency.html#ambient.Profile.buoyancy_frequency" title="ambient.Profile.buoyancy_frequency"><code class="xref py py-obj docutils literal notranslate"><span class="pre">buoyancy_frequency</span></code></a>(self, z[, h])</p></td>
<td><p>Calculate the local buoyancy frequency</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.close_nc.html#ambient.Profile.close_nc" title="ambient.Profile.close_nc"><code class="xref py py-obj docutils literal notranslate"><span class="pre">close_nc</span></code></a>(self)</p></td>
<td><p>Close the netCDF dataset</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.extend_profile_deeper.html#ambient.Profile.extend_profile_deeper" title="ambient.Profile.extend_profile_deeper"><code class="xref py py-obj docutils literal notranslate"><span class="pre">extend_profile_deeper</span></code></a>(self, z_new[, …])</p></td>
<td><p>Extend the CTD profile to the depth <cite>z_new</cite> using a fixed buoyancy frequency</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.get_units.html#ambient.Profile.get_units" title="ambient.Profile.get_units"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_units</span></code></a>(self, names)</p></td>
<td><p>Return a list of units for the variables in <cite>names</cite></p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.get_values.html#ambient.Profile.get_values" title="ambient.Profile.get_values"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_values</span></code></a>(self, z, names)</p></td>
<td><p>Return values for the variables listed in <cite>names</cite> interpolated to the depth given by <cite>z</cite></p></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="ambient.Profile.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">self, data, ztsp=['z', 'temperature', 'salinity', 'pressure'], chem_names=None, err=0.01, ztsp_units=['m', 'K', 'psu', 'Pa'], chem_units=None, current=None, current_units=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/ambient.html#Profile.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ambient.Profile.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#ambient.Profile.__init__" title="ambient.Profile.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a>(self, data[, ztsp, chem_names, …])</p></td>
<td><p>Initialize self.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.append.html#ambient.Profile.append" title="ambient.Profile.append"><code class="xref py py-obj docutils literal notranslate"><span class="pre">append</span></code></a>(self, data, var_symbols, var_units[, …])</p></td>
<td><p>Add data to the netCDF dataset and update the object attributes</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.buoyancy_frequency.html#ambient.Profile.buoyancy_frequency" title="ambient.Profile.buoyancy_frequency"><code class="xref py py-obj docutils literal notranslate"><span class="pre">buoyancy_frequency</span></code></a>(self, z[, h])</p></td>
<td><p>Calculate the local buoyancy frequency</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.close_nc.html#ambient.Profile.close_nc" title="ambient.Profile.close_nc"><code class="xref py py-obj docutils literal notranslate"><span class="pre">close_nc</span></code></a>(self)</p></td>
<td><p>Close the netCDF dataset</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.extend_profile_deeper.html#ambient.Profile.extend_profile_deeper" title="ambient.Profile.extend_profile_deeper"><code class="xref py py-obj docutils literal notranslate"><span class="pre">extend_profile_deeper</span></code></a>(self, z_new[, …])</p></td>
<td><p>Extend the CTD profile to the depth <cite>z_new</cite> using a fixed buoyancy frequency</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="ambient.Profile.get_units.html#ambient.Profile.get_units" title="ambient.Profile.get_units"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_units</span></code></a>(self, names)</p></td>
<td><p>Return a list of units for the variables in <cite>names</cite></p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="ambient.Profile.get_values.html#ambient.Profile.get_values" title="ambient.Profile.get_values"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_values</span></code></a>(self, z, names)</p></td>
<td><p>Return values for the variables listed in <cite>names</cite> interpolated to the depth given by <cite>z</cite></p></td>
</tr>
</tbody>
</table>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../index.html">Texas A&M Oil spill / Outfall Calculator</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../../user_manual.html">TAMOC User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../unit_tests.html">Unit Tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../bugs.html">Reporting Bugs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Read Me File</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../release.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../license.html">License</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../../index.html">Documentation overview</a><ul>
  <li><a href="../../user_manual.html">TAMOC User Manual</a><ul>
  <li><a href="../../modules/ambient.html">Overview of Ambient Module</a><ul>
      <li>Previous: <a href="../../modules/ambient.html" title="previous chapter">Overview of Ambient Module</a></li>
      <li>Next: <a href="ambient.Profile.append.html" title="next chapter">ambient.Profile.append</a></li>
  </ul></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Scott A. Socolofsky.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../../_sources/autodoc/ambient/ambient.Profile.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>